package com.itouch.bracelet.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.itouch.bracelet.R;
import com.itouch.bracelet.bean.Child;

/**
 * 孩子选择适配器
 * @author SunshineHu
 *
 */
public class ChildSelectAdapter extends BaseAdapter{

	private List<Child> mylist;
	private LayoutInflater inflater;
	
	public ChildSelectAdapter(Context c,List<Child> list) {
		// TODO Auto-generated constructor stub
		inflater=LayoutInflater.from(c);
		mylist=list;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return mylist.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		if(convertView==null){
			convertView=inflater.inflate(R.layout.child_select_adapter, null);
		}
		TextView name=(TextView) convertView.findViewById(R.id.name);
		TextView no=(TextView) convertView.findViewById(R.id.no);
		
		name.setText(mylist.get(position).getName());
		no.setText(mylist.get(position).getDeviceNo());
		
		convertView.setTag(mylist.get(position));
		
		return convertView;
	}

}
